<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Minim : : Balance : : patch</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body> 
<center>
<table class="mainTable">

  <tr>
    <td class="header">
    	<span class="indexheader">Minim</span><br/>
    	<span class="indexnavigation">
    		<a href="index.html">core</a> | 
    		<a href="index_ugens.html">ugens</a> | 
    		<a href="index_analysis.html">analysis</a>
    	</span>
    </td>
    <td class="border-left">&nbsp;</td>
  </tr>
  
  <tr>
    <td class="classNavigation">
    	<p class="mainTextName"><A href="ugen_class_ugen.html">UGen</A></p>
    	<p class="methodName">patch</p>
    </td>
    <td class="mainText border-left">
    	<p class="memberSectionHeader">Description</p>
    	Send the output of this UGen to another UGen, UGenInput, or AudioOutput.
 For instance, if an Oscil is patched to an AudioOutput, you will hear 
 the sound it generates. If a FilePlayer is patched to a Delay, then the 
 delay effect will be applied to the sound generated by the FilePlayer.
    	
    	<p class="memberSectionHeader">Signature</p>
    	<pre>UGen patch(UGen connectToUGen)
UGen patch(UGen.UGenInput connectToInput)
void patch(AudioOutput audioOutput)
</pre>
    	
    	
   <p class="memberSectionHeader">Parameters</p>
   
        <span class="parameterName">connectToUGen</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">The UGen to patch to.</span><br/>
    
        <span class="parameterName">connectToInput</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">The UGenInput to patch to.</span><br/>
    
        <span class="parameterName">audioOutput</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">The AudioOutput you want to connect this UGen to.</span><br/>
    
   
    	
   <p class="memberSectionHeader">Returns</p> 
   <p>When patching to a UGen or UGenInput, the UGen being patched to is returned 
 		   so that you can chain patch calls. For example:
 
 <pre>
 sine.patch( gain ).patch( out );
 </pre></p>
   
    	
    	<p class="memberSectionHeader">Related</p>
    	
    	
    	<p class="memberSectionHeader">Example</p>
    	<pre>/**
  * This sketch demonstrates how to create a simple synthesis chain that 
  * involves controlling the value of a UGenInput with the output of 
  * a UGen. In this case, we patch an Oscil generating a sine wave into 
  * the amplitude input of an Oscil generating a square wave. The result 
  * is known as amplitude modulation.
  * &lt;p>
  * For more information about Minim and additional features, 
  * visit http://code.compartmental.net/minim/
  */

import ddf.minim.*;
import ddf.minim.ugens.*;

Minim minim;
AudioOutput out;
Oscil       wave;
Oscil       mod;

void setup()
{
  size(512, 200, P3D);
  
  minim = new Minim(this);
  
  // use the getLineOut method of the Minim object to get an AudioOutput object
  out = minim.getLineOut();
  
  // create a triangle wave Oscil, set to 440 Hz, at 1.0 amplitude
  // in this case, the amplitude we construct the Oscil with 
  // doesn't matter because we will be patching something to
  // its amplitude input.
  wave = new Oscil( 440, 1.0f, Waves.TRIANGLE );
 
  // create a sine wave Oscil for modulating the amplitude of wave
  mod  = new Oscil( 2, 0.4f, Waves.SINE );
 
  // connect up the modulator
  mod.patch( wave.amplitude );
  
  // patch wave to the output
  wave.patch( out );
}

void draw()
{
  background(0);
  stroke(255);
  
  // draw the waveforms
  for(int i = 0; i &lt; out.bufferSize() - 1; i++)
  {
    line( i, 50 + out.left.get(i)*50, i+1, 50 + out.left.get(i+1)*50 );
    line( i, 150 + out.right.get(i)*50, i+1, 150 + out.right.get(i+1)*50 );
  }
}
</pre>
    	
    	<p class="memberSectionHeader">Usage</p>
    	Web & Application
    </td>
  </tr>
</table>
</center>
</body>
</html>
